/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hcmus.fit.master.sevensea.sprite;

import hcmus.fit.master.sevensea.background.Sea;
import hcmus.fit.master.sevensea.core.AbstractSprite;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Bitmap;

/**
 * 
 * @author hvp
 */
public class Rubble extends AbstractSprite {
    public static List<List<Bitmap>> Resource;

    public Rubble(Sea seaMap, int x, int y) {
        super(seaMap, x, y);
        setFrames(Resource.get(0));
        setNbOfFrame(getFrames().size());
    }

    public boolean isRubble() {
        return true;
    }

    public static List<List<Bitmap>> GetResource(Bitmap resource, int maxX, int maxY,
            int numerator, int denominator) {
        List<List<Bitmap>> rs = new ArrayList<List<Bitmap>>();
        int w = resource.getWidth() / maxX;
        int h = resource.getHeight() / maxY;

        for (int i = 0; i < maxY; i++) {
            List<Bitmap> tmp = new ArrayList<Bitmap>();
            for (int j = 0; j < maxX; j++) {
                tmp.add(Bitmap.createBitmap(resource, j * w, i * h, w, h));
                // g.DrawImage(resource, new Rectangle(0, 0, w1, h1), j * w, i *
                // h, w, h, GraphicsUnit.Pixel, imgatt);
            }
            rs.add(tmp);
        }
        return rs;
    }
}
